{include file="/wap/public/top" /}  
{include file="/public/layui" /}
<link href="__indexwap__/css/react.css" rel="stylesheet" type="text/css">
<div class="wrap"> 
   
<div class="header"> 
  
</div>
<form id="theForm">
  <div class="full-line"></div>
  <div class="container-wrap">
    <div class="wrapwidth">
      <div class="safeindex">
        <div id="forgot-password-react-wrapper"><div>
          <div class="forgot-password">
            <div class="forgot-password-body" id="isnplay">
             <div><h2 class="orange">找回密码</h2>
                <ul>
                     <li><label>用户名：</label><input name="username" type="text" class="borderchange" style="    width: 60%;" placeholder="" id="username"></li>
                     <li><label>手机号码：</label><input type="text" name="mobile" class="borderchange"style="    width: 60%;" placeholder="" id="mobile" style="margin-left:5px;"><span class="error-tip"></span></li>
                     <li><label style="width:100px;padding-right:0px;">验证码：</label><input name="vertify" type="text" id="code" class="borderchange" placeholder="" style="width:100px;margin-left:22px;">

                     <span class="captcha">
                      <a href="javascript:;"><img id='imgVerify' src="{:captcha_src()}" onclick="this.src='{:captcha_src()}'"></a></span></li>

                      <span id="error"></span>
                      <li class="submit-btn"><input type="button" id="mo"class="btn btn-primary forgetPassWordBtn" value="重置密码" style="background:#ef742f;border:none;"></li>
                  </ul>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
  </form>
  </div>
<script type="text/javascript">
        var mobile_timeout;
        var mobile_count = 100;
        var mobile_lock = 0;
        $(function () {
            $("#jq_send").click(function () {
                if (mobile_lock == 0) {
                    mobile_lock = 1;
                    $.post("/index.php/index/sendsms/sendsms",{mobile:$("#mobile").val()},function(data){
                        if(data.status == 'success'){
							console.log(data);
                            mobile_count = 60;
                            
                            BtnCount();
                        }else{
							
                            mobile_lock = 0;
                           
                        }
                    },'json');
                }

            });
        });
		
		
        function BtnCount () {
            if (mobile_count == 0) {
                $('#jq_send').html("重新发送");
                mobile_lock = 0;
                clearTimeout(mobile_timeout);
            }
            else {
                mobile_count--;
                $('#jq_send').html("重新发送(" + mobile_count.toString() + ")秒");
                mobile_timeout = setTimeout(BtnCount, 1000);
            }
        };
    </script> 


<script>
$(function(){
 function loginsubmit(){
                var username=true;
                var password=true;
				var passwordf=true;
				var mobile=true;
                var vertify=true;

                if($('#theForm input[name=username]').val() == ''){
                   msg('用户名不能为空!');
                    $('#theForm input[name=name]').focus();
                    username = false;
                    return false;
                }


               
				if($('#theForm input[name=mobile]').val() == ''){
                   
					msg('手机号不能为空!');
                    $('#theForm input[name=mobile]').focus();
                    mobile = false;
                    return false;
                }

                if($('#theForm input[name=vertify]').val() == ''){
                    msg('验证码不能为空!');
                    $('#theForm input[name=vertify]').focus();
                    vertify = false;
                    return false;
                }
//'pwd':$('#theForm input[name=password]').val()
                if(vertify && $('#theForm input[name=username]').val() != '' && $('#theForm input[name=password]').val() != ''){
                    $.ajax({
                        async:false,
                        url:"{:url('index/zhpwd')}",
                        data:{'name':$('#theForm input[name=username]').val(),'mobile':$('#theForm input[name=mobile]').val(),'vertify':$('#theForm input[name=vertify]').val()},
                        type:'post',
                        dataType:'json',
                        success:function(res){
							console.log(res);
                            if(res.status != 1){
                                //$('#error').html('<span class="error">'+res.msg+'!</span>');
								msg(res.msg);
                               // fleshVerify();
                                username=false;
                                password=false;
                                return false;
                            }else{
								//msg("操作成功,重置为初始密码");
                                top.location.href = res.url;
                            }
                        },
                        error : function(XMLHttpRequest, textStatus, errorThrown) {
							console.log(XMLHttpRequest.responseText);
							msg("网络失败，请刷新页面后重试!");
							return false;
                           // $('#error').html('<span class="error">网络失败，请刷新页面后重试!</span>');
                        }
                    });
                }else{
                    return false;
                }
				return false;
            }

            $('.submit_span .sub').on('click',function(){
                $('.code').show();
            });
            $('#mo').on('click',function(){
				
                loginsubmit();
            });
			$('#mof').on('click',function(){
				
                loginsubmitf();
            });
			
			$(document).click(function(e){
				if(e.target.name !='vertify' && !$(e.target).parents("div").is(".submitDiv")){
					$('.code').hide();
				}
			});
            //回车提交
            $(document).keyup(function(event){
                if(event.keyCode ==13){
                    var isFocus=$("#vertify").is(":focus");
                    if(true==isFocus){
                        loginsubmit();
                    }
                }
            });
			function fleshVerify(){
            $('#imgVerify').attr('src','{:captcha_src()}');//重载验证码
        }
        });
</script>

  {include file="/wap/public/hder" /}